#include<stdio.h>
#include<iostream.h>


//This class is Of taylor series Method for finding solution of differential equation 
//
//  This class is designed for function - 2*T*Y 

class TaylorSeries{


  double t,y; // value points
  double h;   // step size  
  double initialY0; //initial value of y1 
  
  public:
  // parameterized constructor:
 // This is to assign value points at the time of construction of object
 // These are the basic value points
  TaylorSeries(double,double);
  

  
 // Default constructor: 
 // This is to assign value points at the time of construction of object 
 // By default it will set interval [0,1]
  TaylorSeries();

  
  // The derivative evaluated at initial points (t0,y0)  for function      ( - 2 * T * Y )  or  ( t - y) / 2 on [0, 3] with y0=1  
  const double getD1();
  const double getD2(); 
  const double getD3();
  const double getD4();
  
  // set new value of t
  void setT(const double );
  
  //set net value of y
  void setY(const double );
  
  
  // return Y
  const double getY();
  
 // return T 
  const double getT();
  
 // This method will set the initial value of Y0
 void setInitialY0(const double initialY0);
  
 // This method will return the initial value of Y0 
 const double getInitialY0();
 
 //
  const double getH();
  
 //
 
  void setH(const double ); 
};




    TaylorSeries::TaylorSeries(){
      
        t=0.0;
	y=0.0;
    } 
    
    
    TaylorSeries::TaylorSeries(double t,double y){
    
         this->t = t;
	 this->y = y; 
    }

const double TaylorSeries::getD1(){

     //return (double) ((t-y) /2 ) ;    
       return ( double ) ( - 2 * t * y); 
}


const  double TaylorSeries::getD2(){

     //return (double) ((2 - t + y) /4 ) ;    
       return (double) ( -2 * ( y + t * ( - 2 * t * y)) );
}


const  double TaylorSeries::getD3(){

     return (double) ((-2 + t - y) /8 ) ;    
}



const double TaylorSeries::getD4(){

     return (double) ((2 - t + y) /16 ) ;    
}



void TaylorSeries::setT(const double t){

       this->t=t;
     
}

void TaylorSeries::setY(const double y){

       this->y=y; 
}


const double TaylorSeries::getT(){

  return t;
}


const double TaylorSeries::getY(){

  return y;
  
}


const double TaylorSeries::getInitialY0(){

  return initialY0;
  
}


void TaylorSeries::setInitialY0(const double initialY0){

  this->initialY0=initialY0; 
  
}



void TaylorSeries::setH(const double h){

 this->h = h;
} 


const double TaylorSeries::getH(){

   return h;
}

